package com.gastudio.Protocol;

import org.apache.mina.core.service.IoHandlerAdapter;
import org.apache.mina.core.session.IdleStatus;
import org.apache.mina.core.session.IoSession;

/**
 * Created by 余艾龙 on 2017/6/21.
 */
public class ProtocolServerHandler extends IoHandlerAdapter {

    @Override
    public void sessionIdle(IoSession session, IdleStatus status) throws Exception {
        System.out.println("服务端进入休眠");
    }

    @Override
    public void exceptionCaught(IoSession session, Throwable cause) throws Exception {
        System.out.println("服务端异常");
    }

    @Override
    public void messageReceived(IoSession session, Object message) throws Exception {
        ProtocolPack pack=(ProtocolPack)message;
        System.out.printf("服务端接收到：%s%n", pack);
    }
}
